#!/bin/bash
if [ $# -lt 1 ]; then
   echo "please input :func_no"
   exit -1
fi

func_no=$1

# hive tables
tmp_file=/tmp/func_hive_tables_$func_no.sql
cat >> $tmp_file << EOF
CREATE TABLE IF NOT EXISTS ACRM_TRANSACTION(CUSTOMER_ID STRING,TRAN_DATE STRING,TRAN_TYPE STRING, CHANNEL STRING, AMOUNT BIGINT) PARTITIONED BY (DS_NO STRING);
CREATE TABLE IF NOT EXISTS ACRM_RFM(CUSTOMER_ID STRING, R STRING, F STRING,  M STRING, RFM STRING)  PARTITIONED BY (CACHE_ID STRING);
EOF

$HIVE_HOME/bin/hive -f "$tmp_file"

rm $tmp_file
